package com.takanafu.haru.code.builtins{
	import com.takanafu.haru.code.CodeBase;
	import com.takanafu.haru.code.CodeINT;
	
	import mx.collections.ArrayCollection;
	
	public class Max extends AbstractBuitin{
		public function Max(){
			super(2);
		}
		
		override public function exec(params:ArrayCollection):CodeBase{
			var firstCode:CodeBase = params.getItemAt(0) as CodeBase;
			var secondCode:CodeBase = params.getItemAt(1) as CodeBase;
			
			var i1:CodeINT = firstCode as CodeINT;
			var i2:CodeINT = secondCode as CodeINT;
			
			return new CodeINT(Math.max(i1.getValue(),i2.getValue()));
		}
	}
}